package com.dodo.blog.server;

import com.dodo.blog.exception.EmailAlreadyExists;
import com.dodo.blog.exception.LoginAlreadyExists;
import com.dodo.blog.model.Account;

/**
 * @author <a href="mailto:pohorelec@comvai.com">Jozef Pohorelec</a>
 */
public interface AccountService
{
    /**
     * Save acount to datastore
     *
     * @param account {@link com.dodo.blog.model.Account} entity to save
     */
    void saveAccount( Account account );

    /**
     * Register account to blog
     *
     * @param account {@link com.dodo.blog.model.Account} entity to register
     * @throws com.dodo.blog.exception.EmailAlreadyExists
     *          if login type is OPEN_ID or OAUTH and user for specified email already exists
     * @throws com.dodo.blog.exception.LoginAlreadyExists
     *          if login type is LOGIN and user for specified login already exists
     */
    void register( Account account ) throws EmailAlreadyExists, LoginAlreadyExists;
}